package cn.jishiyu11.xeqb.activity.personalCenterActivitys

import android.os.Bundle
import android.support.design.widget.TabLayout
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.view.View
import android.widget.TextView
import cn.jishiyu11.xeqb.R
import cn.jishiyu11.xeqb.adapter.MyPagerStateAdapter
import cn.jishiyu11.xeqb.base.BaseActivity
import cn.jishiyu11.xeqb.fragment.Card_Fragment
import com.umeng.analytics.MobclickAgent
import kotlinx.android.synthetic.main.act_cardmanager.*
import kotlinx.android.synthetic.main.tab_activity_fra.*

/**
 * Created by jsy_zj on 2018-03-05.
 * 卡片管理
 */
class CardManager:BaseActivity() {

    var titleList  = listOf<String>("信用卡","储蓄卡")
    var fragmentList = listOf<Fragment>(Card_Fragment(titleList.get(0),0), Card_Fragment(titleList.get(1),1))
    var homefm:FragmentManager? = null


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.act_cardmanager)
        findViewById()
        if (titleList.size <=2){
            act_cardmanager_tablelayout.tabMode = TabLayout.MODE_FIXED
        }else{
            act_cardmanager_tablelayout.tabMode = TabLayout.MODE_SCROLLABLE
        }

        act_cardmanager_tablelayout.setupWithViewPager(fg_cardmanager_viewpager)
        homefm = this.supportFragmentManager

        fg_cardmanager_viewpager.adapter = MyPagerStateAdapter(homefm,fragmentList,titleList)

    }


    override fun findViewById() {
        title_image.visibility = View.VISIBLE
        title_image.setOnClickListener{finish()}
        (title_view as TextView).text = this.getString(R.string.personalcenter_card_manager)
    }

    override fun initView() {
    }


    override fun onResume() {
        super.onResume()
        MobclickAgent.onResume(this)
    }

    override fun onPause() {
        super.onPause()
        MobclickAgent.onPause(this)
    }


}